package com.bt.dmdb.model;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import org.hibernate.annotations.Type;
import org.joda.time.LocalDateTime;
import com.bt.dmdb.json.converter.JsonDateDeserializer;
import com.bt.dmdb.json.converter.JsonDateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;


@Entity
@Table(name = "stocks_distribution_copy")
@SuppressWarnings("serial")
public class StocksDistributionCopy implements java.io.Serializable{
	private Long id;
	private String stockholderName;
	private Long ownedPercent;
	private Long value;
	private Long tin;
	private String cAddress;
	private LoginUser createdBy;
	private LocalDateTime creationDate;	
	private CustomerCopy customerCopy;
	
	public StocksDistributionCopy() {
	}
	
	public StocksDistributionCopy(Long id, String stockholderName,
			Long ownedPercent, Long value, Long tin, String cAddress,
			LoginUser createdBy,LocalDateTime creationDate,CustomerCopy customerCopy)
	{
		super();
		this.id = id;
		this.stockholderName = stockholderName;
		this.ownedPercent = ownedPercent;
		this.value = value;
		this.tin = tin;
		this.cAddress = cAddress;
		this.createdBy = createdBy;
		this.creationDate = creationDate;
		this.customerCopy = customerCopy;
	}





	@Id
    @GeneratedValue(generator = "stocksDistributionIG", strategy = GenerationType.TABLE)
    @TableGenerator(name = "stocksDistributionIG", table = "jpa_sequences", pkColumnName = "name", pkColumnValue = "StocksDistribution", allocationSize = 10, valueColumnName = "next_hi_value")
    @Column(name = "id")
	public Long getId() {
		return id;
	}
	
	@Column(name = "stockholder_name")
	public String getStockholderName() {
		return stockholderName;
	}

    @Column(name = "owned_percent")
	public Long getOwnedPercent() {
		return ownedPercent;
	}
    @Column(name = "value")
	public Long getValue() {
		return value;
	}
    @Column(name = "tin")
	public Long getTin() {
		return tin;
	}
    @Column(name = "c_address")
	public String getcAddress() {
		return cAddress;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setStockholderName(String stockholderName) {
		this.stockholderName = stockholderName;
	}

	public void setOwnedPercent(Long ownedPercent) {
		this.ownedPercent = ownedPercent;
	}

	public void setValue(Long value) {
		this.value = value;
	}

	public void setTin(Long tin) {
		this.tin = tin;
	}

	public void setcAddress(String cAddress) {
		this.cAddress = cAddress;
	}
	
	

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "created_by")
	public LoginUser getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(LoginUser createdBy) {
		this.createdBy = createdBy;
	}




	

	@Column(name = "creation_date")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
    @JsonSerialize(using = JsonDateSerializer.class)
    @JsonDeserialize(using = JsonDateDeserializer.class)
	public LocalDateTime getCreationDate() {
		return creationDate;
	}



	public void setCreationDate(LocalDateTime creationDate) {
		this.creationDate = creationDate;
	}

	

	@ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "customer_copy_id")
	public CustomerCopy getCustomerCopy() {
		return customerCopy;
	}

	public void setCustomerCopy(CustomerCopy customerCopy) {
		this.customerCopy = customerCopy;
	}
}
